package com.gpt.kimi.controller;

import cn.hutool.core.collection.CollUtil;
import com.gpt.kimi.utils.Message;
import com.gpt.kimi.utils.MoonshotAiUtils;
import com.gpt.kimi.utils.RoleEnum;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping({"/kimi","/api/kimi"})
public class KimiGptController {

    @RequestMapping("/chat")
    public String chat(@RequestParam("msg") String msg){
        List<Message> messages = CollUtil.newArrayList(
                new Message(RoleEnum.system.name(), "你是kimi AI"),
                new Message(RoleEnum.user.name(), msg)
        );
        return MoonshotAiUtils.chat2("moonshot-v1-8k",messages);
    }
}
